home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / UDPSend.au3 < prev    next >
Text File  |  2007-09-08  |  590b  |  28 lines

  1. ;;This is the UDP Client
  2. ;;Start the server first
  3.  
  4. ; Start The UDP Services
  5. ;==============================================
  6. UDPStartup()
  7.  
  8. ; Open a "SOCKET"
  9. ;==============================================
  10. $socket = UDPOpen("127.0.0.1", 65532)
  11. If @error <> 0 Then Exit
  12.  
  13. $n=0
  14. While 1
  15.     Sleep(2000)
  16.     $n = $n + 1
  17.     $status = UDPSend($socket, "Message #" & $n)
  18.     If $status = 0 then 
  19.         MsgBox(0, "ERROR", "Error while sending UDP message: " & @error)
  20.         Exit
  21.     EndIf
  22. WEnd
  23.  
  24. Func OnAutoItExit()
  25.     UDPCloseSocket($socket)
  26.     UDPShutdown()
  27. EndFunc
  28.